package com.cskaoyan.service.wx.home;

import com.cskaoyan.bean.MarketFeedback;
import com.cskaoyan.bean.MarketUser;
import com.cskaoyan.mapper.MarketFeedbackMapper;
import com.cskaoyan.mapper.MarketUserMapper;
import com.cskaoyan.service.wx.WxFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author Kongwo
 * @description
 * @since 2022/05/09 20:05
 */

@Service
@Transactional
public class WxFeedbackServiceImpl implements WxFeedbackService {

    @Autowired
    MarketFeedbackMapper marketFeedbackMapper;

    @Autowired
    MarketUserMapper marketUserMapper;

    @Override
    public void submitFeedback(MarketFeedback marketFeedback, Integer userId) {

        MarketUser marketUser = marketUserMapper.selectByPrimaryKey(userId);
        marketFeedback.setUserId(userId);
        marketFeedback.setUsername(marketUser.getUsername());
        marketFeedbackMapper.insertSelective(marketFeedback);
    }
}
